<?php
	include("config.php");
	include("db.class.php");
	include("global.fun.php");
	include("smarty/smarty.class.php");
	
	date_default_timezone_set("PRC");
	
	define('IP', getIp());
	define('DATE',date("Y-m-d"));
	define('DATETIME',date("Y-m-d H:i:s"));
	define('TIME',time());
	define('START_TIME',microtime());
	
	set_include_path(PATH."include/");
	error_reporting(E_ERROR | E_WARNING | E_PARSE);
	set_magic_quotes_runtime(0);
	unset($HTTP_ENV_VARS, $HTTP_POST_VARS, $HTTP_GET_VARS, $HTTP_POST_FILES, $HTTP_COOKIE_VARS);
	
	header("Content-type: text/html; charset=utf-8");
		
	$webconfig=include(PATH."api/cache/config.php");
	$status=include(PATH."api/cache/status.php");
	$rights=include(PATH."api/cache/rights.php");
	$messages=include(PATH."api/cache/messages.php");
	
	$db=new db();
	$webbar=$db->getlist("select text,link,target from bar where display=1 order by orders");

	$smarty=new smarty();
	$smarty->template_dir=TEMP_PATH;
	$smarty->compile_dir=CACHE_PATH;
	
	$smarty->assign("web",$webconfig);
	$smarty->assign("bar",$webbar);

	unset($wenconfig,$webbar);
	
	if($_REQUEST)
	{
		if(get_magic_quotes_gpc())
		{
			$_REQUEST = new_addslashes(new_trim($_REQUEST));
			if($_COOKIE) $_COOKIE = new_addslashes(new_trim($_COOKIE));
			extract(escape($_REQUEST), EXTR_SKIP);
		}
		else
		{
			$_POST = escape($_POST);
			$_GET = escape($_GET);
			$_COOKIE = escape($_COOKIE);
			@extract($_POST,EXTR_SKIP);
			@extract($_GET,EXTR_SKIP);
			@extract($_COOKIE,EXTR_SKIP);
		}
		if(!defined('IN_ADMIN')) $_REQUEST = filter_xss($_REQUEST);
		if($_COOKIE) escape($_COOKIE);
	}
?>